package com.google.code.tomoponzoo.lab;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Window;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class WebView2Activity extends Activity {
	private WebView webView;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        
        Log.v("Activity", "onCreate");
        
        // Create WebView
        webView = new WebView(this);
        webView.setWebViewClient(new WebViewClientEx());
        webView.setVerticalScrollBarEnabled(false);
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setSavePassword(false);
        settings.setSaveFormData(false);
        settings.setSupportZoom(false);
        
        // HTML Load
        webView.loadUrl("http://118.151.159.201/dev_aws/node/41");
        setContentView(webView);
    }
    
    private final class WebViewClientEx extends WebViewClient {
    	
    	@Override
    	public WebResourceResponse shouldInterceptRequest(WebView view,
    			String url) {
    		// TODO Auto-generated method stub
    		//System.out.println(url);
    		Log.v("URL", url);
    		System.out.println(url);
    		
    		return super.shouldInterceptRequest(view, url);
    	}
    }
}